home *** CD-ROM | disk | FTP | other *** search
/ Gigarom 1 / Gigarom Macintosh Archives (Quantum Leap)(CDRM1080320)(1993).iso / FILES / DEV / I-Z / ViewIt™ Shareware.sea / ViewIt™ 2.04 Shareware / FaceWare.rsrc / TEXT_1246_6. Minimum Code.txt < prev    next >
Text File  |  1992-08-15  |  2KB  |  52 lines

  1. 6. Minimum Code
  2.   All FaceWare modules are shipped with "example" or "demo" programs that illustrate use of the modules.  These programs have a one- or two- letter prefix that designates the associated module:  "vDemoXY" illustrates use of ViewIt, "drDemoXY" of DrawIt, "anDemoXY" of AnimIt, etc.  ("XY" is a compiler designation defined in the "About Compilers" program).  Most such demo programs are quite small (2-4 pages) due to their use of FaceIt & ViewIt to automatically handle most menu and window events, and therefore make a good starting point for new projects.
  3.   Before you explore the vDemoXY (ViewIt) and fDemoXY (FaceIt) demo programs, it is helpful to examine a program that represents the minimum amount of code necessary to open a ViewIt window in a FaceIt-based program.  This code is presented below for the 3 major languages supported:
  4.  
  5. ‚Ä¢ Pascal
  6.  uses FaceStorLP, FaceProcLP;        {C1}
  7.  begin
  8.  fRec.uName := 'Minimum.Rsrc';       {C2}
  9.  FaceIt(nil,DoInit,0,0,0,0);         {C3}
  10.  FaceIt(nil,NewWnd,1000,1,0,0);
  11.  repeat
  12.   FaceIt(nil,DoLoop,0,0,0,0);        {C4}
  13.   if (fRec.uMenuID = 1000) then
  14.    ...
  15.  until false;
  16.  end.
  17.  
  18. ‚Ä¢ C
  19.  #include "FaceStorLC.h"             /*C1*/
  20.  main()
  21.  {
  22.  strcpy(fRec.uName,"Minimum.Rsrc");  /*C2*/
  23.  FaceIt(0L,DoInit,0L,0L,0L,0L);      /*C3*/
  24.  FaceIt(0L,NewWnd,1000L,1L,0L,0L);
  25.  for (;;)
  26.   {
  27.   FaceIt(0L,DoLoop,0L,0L,0L,0L);     /*C4*/
  28.   if (fRec.uMenuID == 1000)
  29.    ...
  30.   }
  31.  }
  32.  
  33. ‚Ä¢ Fortran
  34.  include FaceStorLF.inc              !C1
  35.  record /FaceRec/ fRec
  36.  common/FaceStuff/fRec
  37.  fRec.uName = 'Minimum.Rsrc'         !C2
  38.  FaceIt(0,DoInit,0,0,0,0)            !C3
  39.  FaceIt(0,NewWnd,1000,1,0,0)
  40.  do while (.true.)
  41.   FaceIt(0,DoLoop,0,0,0,0)           !C4
  42.   if (fRec.uMenuID = 1000) then
  43.    ...
  44.  end do
  45.  end
  46.  
  47. The "C#" comments refer to later help topics that describe what the associated code is doing:
  48.   C1 = see Include Files topic
  49.   C2 = see Resource Files topic
  50.   C3 = see Initializations topic
  51.   C4 = see Event Handling topic
  52. Please take the time to read these topics so that you have a good idea why FaceIt-based programs are built around these four elements.